package office.dao.hr;

import platform.common.dao.impl.BaseDomainProviderImpl;

public class ExamineDP extends BaseDomainProviderImpl {
	
	public String getExamineByUidAndManagerId(){
		String hql = "from Examine where toUser.id =:userId and examineManagerId=:examineManagerId and type != 'total' order by type,id";
		return hql;
	}
	
	public String getExamineTotalByUidAndManagerId(){
		String hql = "from Examine where toUser.id =:userId and examineManagerId=:examineManagerId and type = 'total' order by type,id";
		return hql;
	}

	public String getSumScoreByToUseridTypeManager(){
		String hql = "select sum(score) from Examine e where e.toUser.id=:toUserId and e.type=:type and e.examineManagerId=:examineManagerId";
		return hql;
	}
	
	public String getSumPeopleByExamine(){
		String hql = "select distinct e.user.id from Examine e where e.toUser.id=:toUserId and e.type=:type and e.examineManagerId=:examineManagerId";
		return hql;
	}
	
	public String getCalculationTotal(){
		String hql = "from Examine e where e.toUser.id=:toUserId and e.examineManagerId=:examineManagerId and e.eProject.id is null";
		return hql;
	}
	
	public String getExamine(){
		String hql = "from Examine e where e.user.id=? and e.toUser.id=:toUserId and e.eProject.id=:eProjectId and e.examineManagerId=:examineManagerId";
		return hql;
	}
	
	public String getDeleteExamineByManagerId(){
		String hql = "delete from Examine where examineManagerId=:examineManagerId";
		return hql;
	}
	
}
